{* Smarty *}
{*
 *  This file is part of Urd.
 *
 *  Urd is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *  Urd is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program. See the file "COPYING". If it does not
 *  exist, see <http://www.gnu.org/licenses/>.
 *
 * $LastChangedDate: 2008-03-28 22:50:18 +0100 (Fri, 28 Mar 2008) $
 * $Rev: 1068 $
 * $Author: gavinspearhead $
 * $Id: viewfiles.tpl 1068 2008-03-28 21:50:18Z gavinspearhead $
 *}
{include file="head.tpl" title=$title}
{capture assign=submit}
<input type="submit" value="{$LN_apply}" class="submit" name='apply'/>
<input type="submit" value="{$LN_export_groups}" class="submit" name='export'/>

{if $isadmin neq 0 and $urdd_online neq 0}
<input type="button" value="{$LN_import_groups}" class="submit" name='export' onclick="javascript:show_popup_remote('loadsettingsdiv','loadsettings', '{$referrer}');"/>
{/if}
{/capture}

{* Capture the skipper: *}
{capture assign=skipper}
<table class="pageskip"><tr>

{* Determine the start/stop page: *}
{assign var="startpage" value="`$currentpage-10`"}
{if $startpage < 1} {assign var="startpage" value="1"} {/if}
{assign var="stoppage" value="`$startpage+20`"}
{if $stoppage > $lastpage} {assign var="stoppage" value=$lastpage} {/if}
{assign var="startpage" value="`$stoppage-20`"}
{if $startpage < 1} {assign var="startpage" value="1"} {/if}

{section name=x loop=$pages}
{* Always do first *}
{if $pages[x].number == 1}
	<td class="ps_{$pages[x].distance}" onmouseover="this.style.color='white'; this.style.cursor='pointer'" onmouseout="this.style.color='black';" onclick="submit_newsgroup_page({$pages[x].url})">
	{$pages[x].number}
	</td>
	{if $startpage > 1}
		<td class="spacer">&nbsp;</td>
	{/if}
{* Always do last *}
{elseif $pages[x].number == $lastpage}
	{if $stoppage < $lastpage}
		<td class="spacer">&nbsp;</td>
	{/if}
	<td class="ps_{$pages[x].distance}" onmouseover="this.style.color='white'; this.style.cursor='pointer'" onmouseout="this.style.color='black';" onclick="submit_newsgroup_page({$pages[x].url})">
	{$pages[x].number}
	</td>
{* Only do the surrounding ones*}
{elseif $pages[x].number >= $startpage AND $pages[x].number <= $stoppage}
	<td class="ps_{$pages[x].distance}" onmouseover="this.style.color='white'; this.style.cursor='pointer'" onmouseout="this.style.color='black';" onclick="submit_newsgroup_page({$pages[x].url})">
	{$pages[x].number}
	</td>
{/if}
{/section}
</tr></table>
{/capture}


<form action="newsgroups.php" method="post" id="searchngform">
<div>

{$LN_ng_searchtext}: 
<input type="text" name="search" value="{if $search == ''}<{$LN_search}>{else}{$search|escape:htmlall}{/if}" onfocus="if (this.value=='<{$LN_search}>') this.value='';" id="newsearch" size="30"/>
<input type="checkbox" name="search_all" {if $search_all neq 0}checked="checked"{/if} id="search_all"/>{$LN_ng_hide_empty}
<input type="hidden" name="order" id="ng_search_order" value="{$order}"/>
<input type="hidden" name="order_dir" id="ng_search_order_dir" value="{$order_dir}"/>
<input type="hidden" name="challenge" id="challenge1" value="{$challenge}"/>
<input type="hidden" name="unsubscribed" value="{$unsubscribed}"/>
<input type="hidden" name="oldsearch" value="{$search}" id="oldsearch"/>
<input type="hidden" name="offset" value="{$offset}" id="offset"/>
&nbsp;
<input type="submit" value="{$LN_search}" class="submit"/>
</div>
</form>
<form action="newsgroups.php" method="post" id="newsgroupform">
<div>
<input type="hidden" name="order" value="{$order|escape}"/>
<input type="hidden" name="order_dir" value="{$order_dir|escape}"/>
<input type="hidden" name="action" value="foo"/>
<input type="hidden" name="challenge" id="challenge2" value="{$challenge}"/>
{if $unsubscribed eq 0 } <h3>{$LN_ng_subscribed|escape}: {$LN_ng_newsgroups|escape}</h3> {else} <h3>{$LN_ng_newsgroups}</h3>{/if}
</div>
<div>
{$submit}
<span class="Message" id="message_bar">&nbsp;{$message}</span>
<br/>
{$skipper}
<table class="newsgroups">
<tr class="head">
<th {popup text=$LN_ng_tooltip_active }><a href="#" class="head" onclick="javascript:submit_search('active', 'desc');">&nbsp;</a></th>
<th {popup text=$LN_ng_tooltip_name }><a href="#" class="head" onclick="javascript:submit_search('name', 'asc');" >{$LN_ng_name|capitalize}</a></th>
<th {popup text=$LN_ng_tooltip_posts }><a href="#" class="head" onclick="javascript:submit_search('postcount', 'desc');">{$LN_ng_posts|capitalize}</a></th>
<th {popup text=$LN_ng_tooltip_lastupdated }><a href="#" class="head" onclick="javascript:submit_search('last_updated', 'desc');">{$LN_ng_lastupdated}</a></th>
<th {popup text=$LN_ng_tooltip_expire }><a href="#" class="head" onclick="javascript:submit_search('expire', 'desc');">{$LN_ng_expire_time}</a></th>
<th {popup text=$LN_ng_tooltip_visible }><a href="#" class="head" onclick="javascript:submit_search('visible', 'desc');">{$LN_ng_visible|capitalize}</a></th>
<th {popup text=$LN_ng_tooltip_minsetsize }><a href="#" class="head" onclick="javascript:submit_search('minsetsize', 'desc');">{$LN_ng_minsetsize|capitalize}</a></th>
{if $isadmin neq 0 and $urdd_online neq 0 }
<th {popup text=$LN_ng_tooltip_action }>{$LN_ng_uep}</th>
<th {popup text=$LN_ng_tooltip_autoupdate }><a href="#" class="head" onclick="javascript:submit_search('refresh_period','desc');">{$LN_ng_autoupdate|capitalize}</a></th>
<th {popup text=$LN_ng_tooltip_time }><a href="#" class="head" onclick="javascript:submit_search('refresh_time', 'asc');">@ {$LN_ng_time|capitalize}</a></th>
{else}
<th>&nbsp;</th>
{/if}
</tr>

{section name=x loop=$allgroups}
<tr  class="{cycle values="even,odd" name="cycle1"}">
<td>
{if $isadmin neq 0 and $urdd_online neq 0}
<input type="checkbox" name="ng_{$allgroups[x].id}" onclick="ToggleNG({$allgroups[x].id})" {if $allgroups[x].active_val neq 0}checked="checked"{/if}/>
{else}
<input type="checkbox" name="ng_{$allgroups[x].id}" disabled="disabled" {if $allgroups[x].active_val neq 0}checked="checked"{/if}/>
{/if}
<input type="hidden" name="newsgroup[{$allgroups[x].id}]" value="{$allgroups[x].active_val}"/>
<input type="hidden" id="ng_id_{$allgroups[x].id}" value="{$allgroups[x].name}"/>
</td>
{if description neq ''}
{assign var='space' value='<br/>'}
{assign var='tooltip' value=`$allgroups[x].name``$space``$allgroups[x].description` }
{else}
{assign var='tooltip' value=$allgroups[x].name}
{/if}
<td {if $tooltip neq ''}{popup text=$tooltip|escape }{/if}> 
{if $allgroups[x].active_val eq $NG_SUBSCRIBED} <a href="browse.php?groupID={$allgroups[x].id}">{/if}
{$allgroups[x].name|escape|truncate:$maxstrlen}
{if $allgroups[x].active_val eq $NG_SUBSCRIBED}</a>{/if}
</td>
<td>{$allgroups[x].postcount}</td>
<td>{$allgroups[x].lastupdated}</td>
<td><input type="text" size="2" value="{$allgroups[x].expire}" name="expire[{$allgroups[x].id}]" {if $isadmin neq 1 or $urdd_online neq 1} readonly="readonly"{/if}/></td>
<td><input type="checkbox" {if $allgroups[x].visible neq 0} checked="checked" {/if} name="visible[{$allgroups[x].id}]"/></td>
<td><input type="text" size="2" value="{$allgroups[x].minsetsize}" name="minsetsize[{$allgroups[x].id}]"/>
<input type="text" size="2" value="{$allgroups[x].maxsetsize}" name="maxsetsize[{$allgroups[x].id}]"/>
</td>

{if $allgroups[x].active_val eq $NG_SUBSCRIBED and $isadmin neq 0 and $urdd_online neq 0} 
<td>
<img src="{$IMGDIR}/icon_up.png" alt="Update" class="noborder" {popup text=$LN_ng_update } onclick="javascript:ng_action('updategroup', {$allgroups[x].id}, '{$LN_ng_update} {$LN_success}', '{$LN_ng_update} {$LN_failed}');" /><!--/a-->
<img src="{$IMGDIR}/icon_genset.png" alt="Update" class="noborder" {popup text=$LN_ng_gensets } onclick="javascript:ng_action('gensetsgroup', {$allgroups[x].id}, '{$LN_ng_gensets} {$LN_success}', '{$LN_ng_gensets} {$LN_failed}');" /><!--/a-->
<img src="{$IMGDIR}/icon_cancel.png" alt="Expire" class="noborder" {popup text=$LN_ng_expire } onclick="javascript:ng_action('expiregroup', {$allgroups[x].id}, '{$LN_ng_expire} {$LN_success}', '{$LN_ng_expire} {$LN_failed}');" /><!--/a-->
<img src="{$IMGDIR}/icon_purge.png" alt="Purge" class="noborder" {popup text=$LN_ng_purge } onclick="javascript:ng_action_confirm('purgegroup', {$allgroups[x].id}, '{$LN_ng_purge} {$LN_success}', '{$LN_ng_purge} {$LN_failed}', '{$LN_ng_purge} \'@@\'?');" /><!--/a-->
</td>
{else} 
	{if $isadmin eq 1}
	<td>&nbsp;</td>
	{/if}
{/if}

{if $isadmin neq 0 and $urdd_online neq 0}
<td> 
<select name="period[{$allgroups[x].id}]" size="1" class="update">
{html_options values=$periods_keys output=$periods_texts selected=$allgroups[x].select}
</select>
</td>
<td> @ <input type="text" id="time1_{$allgroups[x].id}" name="time1[{$allgroups[x].id}]" value="{$allgroups[x].time1}" class="time"/>:<input type="text" id="time2_{$allgroups[x].id}" class="time" name="time2[{$allgroups[x].id}]" value="{$allgroups[x].time2}"/>
</td>
{/if}
</tr>
{/section}
</table>
{$skipper}
<br/>
{$submit} <br/> 
</div>
</form>
<p>&nbsp;</p>


<div id="loadsettingsdiv" class="loadsettingsoff">
</div>

{include file="foot.tpl"}
